#pragma once
#include "afxwin.h"
#include "Constant.h"
#include "ShadeButtonST.h"
#include "LPCSTRArray.h"

#define IDC_CTRLBUTTON	10000

enum Button_Status{ st_Unlogin, st_Login, st_1stBid, st_2ndBid, st_3rdBid };
class CStepName : public CLPCWSTRArray
{
public:
	CStepName();
	~CStepName();
	void build(LPCWSTR v);
	void drawOut(CDC *pDC, CRect&bounds);
	COLORREF *pColor;
	CString value;
};

class CCtrlButton : public CShadeButtonST
{
	DECLARE_DYNAMIC(CCtrlButton)
public:
	CCtrlButton(TaskHWND task) :m_Task(task){}
	~CCtrlButton(){}
protected:
	DECLARE_MESSAGE_MAP()
public:
	BOOL Create(CWnd* pParentWnd, intptr_t height);
	size_t SetCheck(intptr_t nCheck, BOOL bRepaint = TRUE);
	afx_msg void OnSize(UINT nType, int cx, int cy);

	__forceinline TaskHWND getTask(){ return m_Task; }
	__forceinline void setName(LPCWSTR name){ loginName = name; Invalidate(); }
	void setStatus(LPWSTR caption, intptr_t capLength, Button_Status st, intptr_t price = 0);
	__forceinline void setStep(LPCWSTR name, intptr_t id){ stepName[id].build(name); Invalidate(); }
	__forceinline void setStep(LPCWSTR name1, LPCWSTR name2){ stepName[0].build(name1); stepName[1].build(name2); Invalidate(); }
	__forceinline void setBidProcStatus(intptr_t procStatus){ bidProcStatus = procStatus; }
	__forceinline intptr_t getBidProcStatus(){ return bidProcStatus; }
	__forceinline void setUseRemote(bool use){ useRemote = use; }
	__forceinline void setLFSec(intptr_t lfsec){ lfSeconds = lfsec; }
	__forceinline intptr_t getLFSec(){ return lfSeconds; }
	intptr_t getFocusPriority();
	void SetShowNum(intptr_t num);
protected:
	void DrawItemText(CDC* pDC, const CRect&rcItem) override;
	HBITMAP drawBitmap(bool isIn, COLORREF clrTransparent, intptr_t width, intptr_t height, intptr_t num);

	TaskHWND m_Task;
	CString loginName, statusName;
	CStepName stepName[2];

	Button_Status m_status;
	intptr_t bidPrice;
	intptr_t bidProcStatus;
	intptr_t lfSeconds;
	bool useRemote;
};
